Xbasic

SQL::ConnectionResultSetFromDBF Method

Syntax

SQL::ResultSet ResultSetFromDBF(Table as P [, ParentTable as P] [, ADBPath as C] [, AbsolutePositioning as L)

Arguments

TablePointer

A pointer to an Alpha Anywhere table.

ParentTablePointer

Optional. A pointer to an Alpha Anywhere table.

ADBPathCharacter

Optional. The path of the table's database (ADB) file.

AbsolutePositioningLogical

Logical

Returns

Result_SetSQL::ResultSet

The data retrieved from the Alpha Anywhere table.

Description

Create a SQL::ResultSet object for a table. This object can be passed to SQL update functions.

Discussion

The ResultSetFromDBF() method creates a SQL::ResultSet object for a table. You may pass this object to SQL update functions. Note: Use of ParentTable is an advanced user feature and requires some understanding of caching for SQL.

Example

dim conn as SQL::Connection
dim ti as SQL::TableInfo
dim rs as SQL::ResultSet
dim connstring as C
dim tbl as P
dim insert as C
connstring = "{A5API=Access,FileName='C:\Program Files\A5V8\MDBFiles\Alphasports.mdb', UserName='Admin'}"
if .not. conn.Open(connstring) then
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
if .not. SQL_TableInfoOfDBF("c:\program files\a5v8\samples\alphasports\Customer.dbf", ti) then
    ui_msg_box("Error", "Cannot populate SQL::TableInfo")
    conn.close()
    end
end if
ti.Name = "AlphaSportsCustomer2"
if .not. conn.CreateTable(ti) then
    ui_msg_box("Error", conn.CallResult.text)
    conn.close()
    end
end if
insert = conn.GenerateInsertStatement(ti)
tbl = table.open("c:\program files\a5v8\samples\alphasports\Customer.dbf")
rs = conn.ResultSetFromDBF(tbl)
if .not. conn.ApplyData(insert, rs)
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
tbl.close()
conn.close()

Use of the ParentTable, ADBPath and AbsolutePositioning arguments is an advanced user feature and requires some understanding of caching for SQL.

See Also